﻿using B.S.GridManage.Api.Read.Application.Command.Area;
using B.S.GridManage.Api.Read.Dtos;
using B.S.GridManage.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.GridManage.Api.Read.Controllers
{
    /// <summary>
    ///  area controler
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AreaController : ControllerBase
    {
        private readonly IMediator mediator;

        public AreaController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 区域树接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<AreaTreeDto>>> GetAreaTree([FromQuery]GetAreaTreeCommand request) { 
            return mediator.Send(request);
        }
    }
}
